package net.expectx.gw.util;

import net.expectx.common.base.BaseResultConstants;

/**
 * 统一返回结果类
 *
 * @author 李剑
 * @date 2018/5/21
 */
public class BaseResult {

    /**
     * 是否成功
     */
    private boolean success;

    /**
     * 状态码：1成功，其他为失败
     */
    public int code;

    /**
     * 成功为success，其他为失败原因
     */
    public String message;

    /**
     * 数据结果集
     */
    public Object data;
    public BaseResult(BaseResultConstants baseResultConstants, boolean success, Object data) {
        this.code = baseResultConstants.getCode();
        this.message =  baseResultConstants.getMessage();
        this.success=success;
        this.data = data;
    }
    public BaseResult(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public BaseResult(boolean success, int code, String message, Object data) {
        this.success=success;
        this.code = code;
        this.message = message;
        this.data = data;

    }

    public int getCode() {

        return code;

    }

    public void setCode(int code) {

        this.code = code;

    }

    public String getMessage() {

        return message;

    }

    public void setMessage(String message) {

        this.message = message;

    }

    public Object getData() {

        return data;

    }

    public void setData(Object data) {

        this.data = data;

    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }
}
